/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package marcin.belzowski.geoMap;

import com.vividsolutions.jts.geom.LineString;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import org.hibernate.annotations.Type;

/**
 *
 * @author marcin
 */
@Entity
@Table(name = "miasto")
@NamedQueries({@NamedQuery(name = "City.findAll", query = "SELECT c FROM City c"), @NamedQuery(name = "City.findByGid", query = "SELECT c FROM City c WHERE c.gid = :gid"), @NamedQuery(name = "City.findByStreetlaye", query = "SELECT c FROM City c WHERE c.streetlaye = :streetlaye")})
public class City implements Serializable {
   private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "gid")
    private Integer gid;
    @Column(name = "streetlaye")
    private String streetlaye;
    @Type(type="org.hibernatespatial.GeometryUserType")
    @Column(name = "the_geom")
    private LineString theGeom;

    public City() {
    }

    public City(Integer gid) {
        this.gid = gid;
    }

    public Integer getGid() {
        return gid;
    }

    public void setGid(Integer gid) {
        this.gid = gid;
    }

    public String getStreetlaye() {
        return streetlaye;
    }

    public void setStreetlaye(String streetlaye) {
        this.streetlaye = streetlaye;
    }

    public LineString getTheGeom() {
        return theGeom;
    }

    public void setTheGeom(LineString theGeom) {
        this.theGeom = theGeom;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (gid != null ? gid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof City)) {
            return false;
        }
        City other = (City) object;
        if ((this.gid == null && other.gid != null) || (this.gid != null && !this.gid.equals(other.gid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "marcin.belzowski.geoMap.City[gid=" + gid + "]";
    }

}
